package dk.itu.mmad.travelapp3;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class ChOut_Activity extends Activity {

static String checkOut;
	static String checkIn;
	String tag = "CheckOut";
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_ch_out_);
		checkIn = getIntent().getStringExtra("ci");//CheckinActivity.chIn);
		Toast.makeText(this, "Origin city: " + checkIn, Toast.LENGTH_SHORT).show();
		Button button  = (Button) findViewById(R.id.choutbutton);
		button.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				EditText ed = (EditText) findViewById(R.id.choutstation);
				checkOut = ed.getText().toString();
				Intent intent= new Intent(ChOut_Activity.this, Receipt.class);
				intent.putExtra("ci", checkIn);
				intent.putExtra("co", checkOut);
				startActivity(intent);
			}
		});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_ch_out_, menu);
		return true;
	}
}
